<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHCi.Utils</span><span>
</span><span id="line-3"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHCi.Utils.html#getGhcHandle"><span class="hs-identifier">getGhcHandle</span></a></span><span>
</span><span id="line-4"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.html#"><span class="hs-identifier">Foreign.C</span></a></span><span>
</span><span id="line-7"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.html#"><span class="hs-identifier">GHC.IO.Handle</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier">Handle</span></a></span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LINE 9 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span><span>
</span><span id="line-9"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.IO.Handle.FD</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fdToHandle</span><span class="hs-special">)</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LINE 13 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-comment">-- | Gets a GHC Handle File description from the given OS Handle or POSIX fd.</span><span>
</span><span id="line-17"></span><span class="annot"><a href="GHCi.Utils.html#getGhcHandle"><span class="hs-identifier hs-type">getGhcHandle</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span id="getGhcHandle"><span class="hs-pragma">{-# LINE 19 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span></span><span>
</span><span id="line-19"></span><span class="hs-identifier">getGhcHandle</span><span> </span><span class="hs-identifier">handle</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">_open_osfhandle</span><span> </span><span class="hs-identifier">handle</span><span> </span><span class="hs-special">(</span><span class="hs-number">32768</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-identifier">fdToHandle</span><span>
</span><span id="line-20"></span><span class="hs-pragma">{-# LINE 20 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;io.h _open_osfhandle&quot;</span></span><span> </span><span id="_open_osfhandle"><span class="annot"><a href="GHCi.Utils.html#_open_osfhandle"><span class="hs-identifier hs-var">_open_osfhandle</span></a></span></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-22"></span><span>    </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-pragma">{-# LINE 26 &quot;libraries\\libiserv\\src\\GHCi\\Utils.hsc&quot; #-}</span><span>
</span><span id="line-26"></span></pre></body></html>